Skip to content

Feature/asymptotics#150

Merged
RotemKalisch merged 49 commits intomasterfrom
feature/asymptotics
Apr 2, 2026
Merged

Feature/asymptotics#150
RotemKalisch merged 49 commits intomasterfrom
feature/asymptotics

Conversation

@RotemKalisch
Copy link
Copy Markdown
Member

@RotemKalisch RotemKalisch commented Mar 6, 2026

Birkhoff-Trjitzinsky Asymptotics

Classes

SeriesMatrix

Introduced SeriesMatrix, a formal Puiseux Series Ring, to handle formal power series expansions in terms of a ramified local parameter t = n^{-1/p}. It supports exact Cauchy multiplication, formal inversion, and generalized binomial discrete shifts (n -> n+1).

GrowthRate

Implements a Tropical Semiring to track and compare asymptotic hierarchies (factorials, exponentials, sub-exponentials, polynomials, and logarithms). Overloads + to act as an L_infinity max-filter (safely isolating dominant terms without SymPy relational crashes) and * for asymptotic term multiplication and degree shifting.

Reducer

The core Birkhoff-Trjitzinsky algebraic solver. Iteratively applies gauge transformations (shears) and series ramification to deflate the Poincaré rank of formal difference systems until they completely decouple into scalar equations. Outputs the mathematically pure Canonical Fundamental Matrix (CFM).

Usage

Extracts a formal basis of asymptotic solutions for scalar linear difference equations. Because a linear recurrence is inherently solved as a companion matrix, the gauge transformation to physical space is the identity matrix (U = I). The formal BT solutions map strictly 1:1 to the sequence bounds.

from ramanujantools import LinearRecurrence, Matrix
import sympy as sp
from sympy.abc import n

M = Matrix([
    [1, n**3, (n - 1)*(3*n + 3)*(n**2 + n + 1)],
    [2, 1 - 3*n**2, (-n - 1)*(8*n**2 + n + 5)],
    [1, 3*n + 2, 6*n*(n + 1)]
])

# Convert the coupled system into a scalar sequence
lr = LinearRecurrence(M)

# Extract the pure formal asymptotic basis
lr_bounds = lr.asymptotics()

@RotemKalisch RotemKalisch self-assigned this Mar 6, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Birkhoff–Trjitzinsky-based asymptotics engine for linear difference systems/recurrences, adding core algebra types (formal series ring + tropical growth comparisons) and wiring them into LinearRecurrence.asymptotics() with accompanying unit tests.

Changes:

  • Added new asymptotics subsystem (SeriesMatrix, GrowthRate, Reducer) and extensive test coverage for reduction/growth extraction.
  • Extended Matrix utilities (degrees, Jordan form block sorting, infinity-limit helper) and added tests for degree extraction.
  • Added LinearRecurrence.asymptotics() plus tests (including MeijerG-derived regressions).

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
ramanujantools/matrix.py Adds caching to companion coboundary matrix; adds degree extraction, Jordan block sorting, and an infinity-limit helper.
ramanujantools/matrix_test.py Adds unit test for new Matrix.degrees().
ramanujantools/linear_recurrence.py Adds hashing + asymptotics extraction via the new reduction engine, with precision backoff.
ramanujantools/linear_recurrence_test.py Updates existing tests and adds Fibonacci asymptotics test (but introduces global test state).
ramanujantools/cmf/meijer_g_test.py Adds asymptotics regression tests via LinearRecurrence.
ramanujantools/asymptotics/series_matrix.py New formal Puiseux/Taylor series matrix ring implementation.
ramanujantools/asymptotics/series_matrix_test.py New unit tests for SeriesMatrix operations.
ramanujantools/asymptotics/reducer.py New BT reduction engine and canonical growth/fundamental matrix extraction.
ramanujantools/asymptotics/reducer_test.py New reducer correctness and guardrail tests.
ramanujantools/asymptotics/growth_rate.py New tropical growth semiring/comparator implementation.
ramanujantools/asymptotics/growth_rate_test.py New unit tests for growth comparisons and operations.
ramanujantools/asymptotics/__init__.py Exports the new asymptotics API surface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RotemKalisch RotemKalisch force-pushed the feature/asymptotics branch from 74cfc8d to 805a667 Compare April 2, 2026 20:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RotemKalisch RotemKalisch merged commit f3bb146 into master Apr 2, 2026
2 checks passed
@RotemKalisch RotemKalisch deleted the feature/asymptotics branch April 2, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants